<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Namespace: Messaging</title>

    <script src="scripts/prettify/prettify.js"></script>
    <script src="scripts/prettify/lang-css.js"></script>
    <!--[if lt IE 9]>
    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Namespace: Messaging</h1>
    <section>
        <header>
            <h2>
                Messaging
            </h2>

        </header>

        <article>
            <div class="container-overview">

                <div class="description">Messaging send and receiving message using Cordova plugin.
                    <p>
                        This programming interface allows a JavaScript client application to use the
                        MQTT V3.1 protocol to connect to an MQTT-supporting messaging server.

                        The function supported includes:
                    <ol>
                        <li>Connecting to and disconnecting from a server. The server is identified
                            by its host name and port number.
                        <li>Specifying options that relate to the communications link with the
                            server, for example the frequency of keep-alive heartbeats, and whether
                            SSL/TLS is required.
                        <li>Subscribing to and receiving messages from MQTT Topics.
                        <li>Publishing messages to MQTT Topics.
                    </ol>
                    <p>
                        <b>The API consists of two main objects:</b>
                    <dl>
                        <dt><b><a href="Messaging.Client.html">Messaging.Client</a></b></dt>
                        <dd> This contains methods that provide the functionality of the API,
                            including provision of callbacks that notify the application
                            when a message arrives from or is delivered to the messaging server,
                            or when the status of its connection to the messaging server changes.
                        </dd>

                        <dt><b><a href="Messaging.Message.html">Messaging.Message</a></b></dt>
                        <dd>This encapsulates the payload of the message along with various attributes
                            associated with its delivery, in particular the destination to which it has
                            been (or is about to be) sent.
                        </dd>
                    </dl>
                    <p>
                        The programming interface validates parameters passed to it, and will throw
                        an Error containing an error message intended for developer use
                        or pass the error message to an Failure callback if set,
                        if it detects an error with any parameter.

                    <p>
                        <b>Example:</b>

                        <code><pre>
client = new Messaging.Client(location.hostname, Number(location.port),&quot;clientId&quot;);
client.onConnectionLost = onConnectionLost;
client.onMessageArrived = onMessageArrived;
client.trace = onTrace;
client.connect({
	onSuccess : onConnect
});

function onConnect() {
	// Once a connection has been made, make a subscription and send a message.
	console.log(&quot;onConnect&quot;);
	client.subscribe(&quot;/World&quot;);
	message = new Messaging.Message(&quot;Hello&quot;);
	message.destinationName = &quot;/World&quot;;
	client.send(message);
};
function onConnectionLost(responseObject) {
	if (responseObject.errorCode !== 0)
		console.log(&quot;onConnectionLost:&quot; + responseObject.errorMessage);
};
function onMessageArrived(message) {
	console.log(&quot;onMessageArrived:&quot; + message.payloadString);
	client.disconnect();
};
function onTrace(err){
	console.log('['+ err.severity+']:'+err.message)	;
};
</pre>
                        </code>
                </div>


                <dl class="details">


                    <dt class="tag-source">Source:</dt>
                    <dd class="tag-source">
                        <ul class="dummy">
                            <li>
                                <a href="mqttCordovaClient.js.html">mqttCordovaClient.js</a>, <a
                                    href="mqttCordovaClient.js.html#line19">line 19</a>
                            </li>
                        </ul>
                    </dd>

                </dl>

            </div>

            <h3 class="subsection-title">Classes</h3>

            <dl>
                <dt><a href="Messaging.Client.html">Client</a></dt>
                <dd></dd>

                <dt><a href="Messaging.Message.html">Message</a></dt>
                <dd></dd>
            </dl>
        </article>
    </section>
</div>

<nav>
    <h2><a href="index.html">Index</a></h2>

    <h3>Classes</h3>
    <ul>
        <li><a href="Messaging.Client.html">Client</a></li>
        <li><a href="Messaging.Message.html">Message</a></li>
    </ul>
    <h3>Namespaces</h3>
    <ul>
        <li><a href="Messaging.html">Messaging</a></li>
    </ul>
</nav>

<br clear="both">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Fri Apr 04 2014
    15:56:12 GMT+0900 (China Standard Time)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"></script>
</body>
</html>